namespace CSharpPro._0925;

public class Three
{
    //属性
    private int id;
    private String name;
    private String gender;

    //getter和setter
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    } 
    
    //方法
    public void TestPrint()
    {
        Console.WriteLine("Demo类和方法。");
    }

    //判断各个位数上的数字
    public void TestPrint1()
    {
        Console.WriteLine("输入一个三位整数：");
        Console.WriteLine();
        int i= Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("百位数字："+i/100);
        Console.WriteLine("十位数字："+i%100/10);
        Console.WriteLine("个位数字："+i%10);
    }

    //作业1
    //判断是否为闰年
    public void TestPrint2()
    {
        bool flag = false;
        int note = 2;
        Console.WriteLine("请输入一个年份判断是否为闰年：");
        Console.WriteLine();
        int year=Convert.ToInt32(Console.ReadLine());
        if (year%4==0&&year%100!=0||year%400==0)
        {
            flag = true;
            note = 1;
        }
        if (flag)
        {
            Console.WriteLine(year+"年是闰年。");
        }
        else
        {
            Console.WriteLine(year+"年不是闰年。");
        }

        switch (note)
        {
            case 1:Console.WriteLine(year+"年是闰年。"); break;
            case 2:Console.WriteLine(year+"年不是闰年。"); break;
        }
    }
    
    //作业2
    //计算旅游费用
    public void TestPrint3()
    {
        double cost = 8800;
        Console.WriteLine("请选择出行方式：");
        Console.WriteLine("动车出行请输入1。");
        Console.WriteLine("航班出行请输入2。");
        Console.WriteLine("请输入你的选项：");
        int transport = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("请输入出行月份：");
        int month = Convert.ToInt32(Console.ReadLine());

        //动车出行淡季3折旺季7.5折
        if (transport == 1)
        {
            switch (month)
            {
                case 1:
                case 2:
                case 3:
                case 4:
                    cost=cost*0.3;
                    break;
                case 5 :
                case 6:
                case 7:
                case 8: 
                case 9: 
                case 10:
                    cost=cost*0.75;
                    break;
                case 11: 
                case 12:
                    cost=cost*0.3;
                    break; 
            }
        }
        //航班淡季六折，旺季九折
        else
        {
            switch (month)
            {
                case 1:
                case 2:
                case 3:
                case 4:
                    cost=cost*0.6;
                    break;
                case 5: 
                case 6: 
                case 7: 
                case 8:
                case 9:
                case 10:
                    cost=cost*0.9;
                    break;
                case 11:
                case 12:
                    cost=cost*0.6;
                    break;
            }
        }
        Console.WriteLine("旅游消费"+cost+"元。");
    }
}